package fina2.dcs.upload;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;

import javax.ejb.Local;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import fina2.dcs.common.returns.jaxb.RETURN;
import fina2.dcs.common.upload.UploadedFileInfo;
import fina2.dcs.returns.ImportReturn;
import fina2.dcs.security.User;

@Local
public interface UploadedFileLocal {
public void postConstruct();
	
	public void prePassivate();
	
	public void postActivate();
	
	public void preRemove();
	
	public List<UploadedFile> loadFilesToDownload(ArrayList<Long> ids)throws Exception;
	
	public List<UploadedFile> loadUploadedFiles(UploadedFile uf);
	
	public List<Long> getFileIds();
	
	public List<UploadedFile> getUploadedFiles();

	public void setUploadedFiles(List<UploadedFile> allUploadedFiles);
	
	public void upload(String name, byte[] content, User user,String spDefaultPattern,String spMfbHisPattern,String spProtPass,Properties p);
	
	public String upload(Map<String, byte[]> uploadFiles, User user,Properties p);

	public List<UploadedFileInfo> upload(String name, byte[] content, User user, String spDefaultPattern, String spMfbHisPattern, String spProtPass);
   //                       public String upload(String name, byte[] content, User user, String spDefaultPattern, String spMfbHisPattern, String spProtPass);
	public Map<String, List<UploadedFileInfo>> upload(Map<String, byte[]> uploadFiles, User user);
	//public TreeMap<String,Integer> upload(Map<String, byte[]> uploadFiles, User user);
	
	public UploadedFile findByPrimaryKey(long id);

	public List<ImportReturn> loadXmls();
	

	public long getDataAmmountByStatus(String userName, Integer status);

	public long getMaxId();

	public long getFileToRemove();

	public void setFileToRemove(long fileToRemove);

	public void removeFile(ArrayList<Long> ids);
	
	public long getFileId();

	public void setFileId(long fileId);
	
	public List<ImportReturn> getXmls();

	public void setXmls(List<ImportReturn> xmls);
	
	public String getHeader();
	
	public void remove();

	public void storeFiles(SimpleDateFormat sdf, int userId, int langId, RETURN ret, UploadedFile current, Marshaller mar) throws JAXBException, IOException, ParseException;
	
	public void clear();
}
